<?php
 //Zend_Loader::loadFile('../application/admin/models/Template.php');
class Form_Newsletter extends Zend_Form
{
    public function init()
    {
		$this->setMethod('post');
		$this->addPrefixPath('Lion_Form_Element', '../library/Form/Element/', 'element');	
	  
		
		 
	   $this->addElement('hidden', 'newsletter_id', array(
            
            'filters'    => array('int'),
            'class'			 => 'hidden',
           
        ));
        
		
		 $this->addElement('hidden', 'newsletter_id', array(
	            
	            'filters'    => array('int'),
	            'class'			 => 'hidden',
	           
	        ));
	   
        
		
	     $template_id= new Zend_Form_Element_Select('template_id');
         $template_id ->setLabel('Template')
					->addMultiOptions($this->getTemplates());
						
		$this->addElement($template_id);
												
        $this->addElement('text', 'newsletter_title', array(
            'label'      => 'Newsletter Title:',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'class'			 => 'textbox',
            'validators' => array(
            	array('validator' => 'StringLength', 'options' => array(0, 100))
            )
        ));
        
		
             
        $this ->addElement('formRTE', 'newsletter_content',
    				array('label' =>'Newsletter content:', 
    					'required' =>true,    					
    					'validators' =>array(
    					array('validator' =>'StringLength', 'options' =>array(0, 1000))
    				),    				
		)); 

        
		  $this->addElement('submit', 'Add');
        
		
		
    }
    
    public function getTemplates() {
    	Zend_Loader::loadFile('../application/admin/models/Template.php');
        $template_model = new Template();
        $options=$template_model->listTemplatesfornewsletter();
       // print_r($options);exit;
        $arr=array(0=>'Select template');
        $options=$arr+$options;
      // print_r($options);exit;
        return $options;
    }
    
}
